package com.cn.xcsharp.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@ComponentScan
@Configuration
public class WebConfigurer implements WebMvcConfigurer {

    @Autowired
    PreReadUploadConfig uploadConfig;
    //配置图片访问路径
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
//        registry.addResourceHandler("/static/**").addResourceLocations("file:E://log/img/");
        registry.addResourceHandler("/static/**").addResourceLocations("file:"+uploadConfig.getImgPath());
    }
}